import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
// import chineseHerbalMedicine from '../views/chineseHerbalMedicine.vue'
// import Mall from '../views/Mall.vue'
// import PageOne from '../views/PageOne.vue'
// import PageTwo from '../views/PageTwo.vue'
import Main from '../views/Main.vue'
import UserMain from '../views/UserMain.vue'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import DataSet from '../views/DataSet.vue'
import PersonalCenter from '../views/PersonalCenter.vue'
import UserHome from '../views/UserHome.vue'
import ImageIdentification from '../views/ImageIdentification.vue'
import Empty from '../views/Empty.vue'
// 1、创建路由组件
Vue.use(VueRouter)

// 2、将路由与组件映射
const routes = [
  {
    path: '/main',
    component: Main,
    name:'main',
    redirect: 'empty',  //重定向
    children: [
      {path: '/empty',name:"empty",component: Empty },
      { path: '/personalCenter',name:"personalCenter",component: PersonalCenter },
    ]
  },
  {
    path: '/userMain',
    component: UserMain,
    name:'userMain',
    redirect: '/userHome',  //重定向
    children: [
      {path: '/userHome',name:"userHome",component: UserHome },
      {path:'/imageIdentification',name:"imageIdentification",component: ImageIdentification},
      {path: '/userPersonalCenter',name:"userPersonalCenter",component: PersonalCenter },
      {path:'/login',name:"login",component: Login},
      {path:'/register',name:"register",component: Register},
    ]
  }
  // ,{path: '/empty',name:"empty",component: Empty },
]

// 3. 创建 router 实例，然后传 `routes` 配置
const router = new VueRouter({
  routes // (缩写) 相当于 routes: routes
})

export default router
